package org.dreamwork.assistant.tools.persistence.gui;

import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;

/**
 * Created by game on 2017/7/31
 */
public class IntegerOnlyDocument extends PlainDocument {
    @Override
    public void insertString (int offs, String str, AttributeSet a) throws BadLocationException {
        try {
            int n = Integer.parseInt (str);
            super.insertString (offs, str, a);
        } catch (Exception ex) {
            // ignore
        }
    }
}